﻿using _02_Prism_Test.Views;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using System.Configuration;
using System.Data;
using System.Windows;

namespace _02_Prism_Test;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : PrismApplication
{
    /// <summary>
    /// 注入服务
    /// </summary>
    /// <param name="containerRegistry"></param>
    override protected void RegisterTypes(IContainerRegistry containerRegistry)
    {
        // Register any type you want to use with Prism here
        //将ViewA和ViewB注册到容器中，类似于讲解中的区域注入
        containerRegistry.RegisterForNavigation<ViewA>();
        containerRegistry.RegisterForNavigation<ViewB>();
    }
    /*/// <summary>
    /// 通过项目引用的方式，注册模块
    /// </summary>
    /// <param name = "moduleCatalog" ></ param >*/
    //protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
    //{
    //    //moduleCatalog.AddModule<ModuleA.ModuleAModule>(InitializationMode.WhenAvailable);
    //    moduleCatalog.AddModule<ModuleAProfile>();
    //    moduleCatalog.AddModule<ModuleBProfile>();
    //    base.ConfigureModuleCatalog(moduleCatalog);
    //}

    /// <summary>
    /// 通过文件夹的方式，注册模块
    /// </summary>
    /// <returns></returns>
    protected override IModuleCatalog CreateModuleCatalog()
    {
        DirectoryModuleCatalog catalog = new DirectoryModuleCatalog() { ModulePath=@".\Modules"};
        return catalog;  
    }

    protected override Window CreateShell()
    {
        return Container.Resolve<MainWindow>();
        //return new MainWindow();
    }
}

